package ro.unibuc.nautilus.controllers;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Required;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.ParameterizableViewController;

import ro.unibuc.nautilus.service.RoutesService;

public class RoutesController extends ParameterizableViewController {
	
	RoutesService routesService;
	
	protected ModelAndView handleRequestInternal(
            HttpServletRequest request,
            HttpServletResponse response) throws Exception {

        ModelAndView mav = new ModelAndView(getViewName());
        mav.addObject("routes", routesService.findAll());
        return mav;
    }

	@Required
	public void setRoutesService(RoutesService routesService) {
		this.routesService = routesService;
	}
}
